home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10131 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  95 lines

  1. Path: inforamp.net!ts26-11
  2. From: rmorin@inforamp.net (Randy Charles Morin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: HELP! Compile Error!
  5. Date: Wed, 06 Mar 96 06:53:04 GMT
  6. Organization: MiddleWorld SoftWare
  7. Message-ID: <4hjco8$elu@sam.inforamp.net>
  8. References: <4hi7vc$ggd@newsbf02.news.aol.com>
  9. NNTP-Posting-Host: ts26-11.tor.inforamp.net
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <4hi7vc$ggd@newsbf02.news.aol.com>,
  13.    mrbig0233@aol.com (MrBig0233) wrote:
  14. >I am an 11-year-old (yes, no typo) programmer, and I am trying to write a
  15. >sorting program for a merit badge. I compile the program, and the error
  16. >is:
  17. >
  18. >SORT.CPP 7: Declaration terminated incorrectly
  19. >
  20. >This is the code:
  21. >
  22. >#include<conio.h>
  23. >#include<stdio.h>
  24. >#include<stdlib.h>
  25. >#include<time.h>
  26. >#include<string.h>
  27. >
  28. >{
  29. >
  30. >    main()
  31. >    randomize(num1);
  32. >    randomize(num2);
  33. >    randomize(num3);
  34. >    randomize(num4);
  35. >    randomize(num5);
  36. >    if (strcmp(num1==<num2))
  37. >    {
  38. >        strcpy(num2,num1);
  39. >    }
  40. >    if (strcmp(num2==<num3))
  41. >    {
  42. >        strcpy(num3,num2);
  43. >    }
  44. >    if (strcmp(num3==<num4))
  45. >    {
  46. >        strcpy(num4,num3);
  47. >    }
  48. >    if (strcmp(num4==<num5))
  49. >    {
  50. >        strcpy(num5,num4);
  51. >    }
  52. >    printf("The numbers, in some order:\n");
  53. >    printf("%d, %d, %d, %d, %d",num1,num2,num3,num4,num5);
  54. >    return;
  55. >}
  56.  
  57. Hey Mr Big!  I think I can help you.
  58. Put the "main()" in front of the first '{' (bracket).
  59.  
  60. Try...
  61. ------------------------------------------------------------
  62. #include<conio.h>
  63. #include<stdio.h>
  64. #include<stdlib.h>
  65. #include<time.h>
  66. #include<string.h>
  67.  
  68. main()
  69. {
  70.     randomize(num1);
  71.     randomize(num2);
  72.     randomize(num3);
  73.     randomize(num4);
  74.     randomize(num5);
  75.     if (strcmp(num1==<num2))
  76.     {
  77.         strcpy(num2,num1);
  78.     }
  79.     if (strcmp(num2==<num3))
  80.     {
  81.         strcpy(num3,num2);
  82.     }
  83.     if (strcmp(num3==<num4))
  84.     {
  85.         strcpy(num4,num3);
  86.     }
  87.     if (strcmp(num4==<num5))
  88.     {
  89.         strcpy(num5,num4);
  90.     }
  91.     printf("The numbers, in some order:\n");
  92.     printf("%d, %d, %d, %d, %d",num1,num2,num3,num4,num5);
  93.     return;
  94. }
  95.